//
//  MusicDetailTableViewCell.m
//  XMLY
//
//  Created by lanou on 15/11/5.
//  Copyright © 2015年 曾杰. All rights reserved.
//

#import "MusicDetailTableViewCell.h"
#import "UIImageView+WebCache.h"
#define screen_width [UIScreen mainScreen].bounds.size.width
#define screen_height [UIScreen mainScreen].bounds.size.height

@implementation MusicDetailTableViewCell




-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _coverSmall = [[UIImageView alloc]initWithFrame:CGRectMake(15, 10, 50, 50)];
        _coverSmall.layer.cornerRadius = 25;
        _coverSmall.layer.masksToBounds = YES;
        [self.contentView addSubview:_coverSmall];
        
        _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(70, 10,screen_width-70, 20)];
        _titleLabel.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:_titleLabel];
        
        _listenView = [[UIImageView alloc]initWithFrame:CGRectMake(70, 40, 20, 20)];
        _listenView.image = [UIImage imageNamed:@"erji"];
        _listenView.alpha = 0.6;
        [self.contentView addSubview:_listenView];
        
        _listenLabel = [[UILabel alloc]initWithFrame:CGRectMake(90, 40, 100, 20)];
        _listenLabel.font = [UIFont systemFontOfSize:12];
        _listenLabel.alpha = 0.6;
        _listenLabel.text = @"sdg";
        [self addSubview:_listenLabel];
        
        _timeView = [[UIImageView alloc]initWithFrame:CGRectMake(130, 43, 15, 15)];
        _timeView.alpha = 0.6;
        _timeView.image = [UIImage imageNamed:@"shijian"];
        [self.contentView addSubview:_timeView];
        
        _timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(150, 40, 100, 20)];
        _timeLabel.font = [UIFont systemFontOfSize:12];
        _timeLabel.alpha = 0.6;
        _timeLabel.text = @"34";
        [self.contentView addSubview:_timeLabel];
        
    }
    return self;
}

-(void)configCellWith:(ChildListModel *)model
{

    self.titleLabel.text = model.title;
    if (model.playtimes>10000.0) {
        self.listenLabel.text =[NSString stringWithFormat:@"%.1f万",model.playtimes/10000 ];

    }
    else
    {
    self.listenLabel.text =[NSString stringWithFormat:@"%ld",(NSInteger)model.playtimes ];
    }
    self.timeLabel.text =[[NSString stringWithFormat:@"%02ld",(NSInteger)model.duration/60] stringByAppendingString:[NSString stringWithFormat:@":%02ld",(NSInteger)model.duration%60]];
    [self.coverSmall sd_setImageWithURL:[NSURL URLWithString:model.coverSmall]];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
